package cn.lx.log.core.entity;

import java.io.Serializable;


/**
 * 收集的日志信息
 */
public class LogInfo  implements Serializable {

    private static final long serialVersionUID = 9129572241630640531L;
    /**
     * 日志追踪ID
     */
    private String traceID;

    /**
     * 请求时间
     */
    private String requestTime;
    /**
     * 请求URL
     */
    private String requestUrl;
    /**
     * 请求URI
     */
    private String requestUri;
    /**
     * 请求方式
     */
    private String requestMethod;
    /**
     * 客户端IP
     */
    private String clientIP;
    /**
     * 请求的类
     */
    private String clazz;
    /**
     * 请求类加方法
     */
    private String classMethod;
    /**
     * 请求参数
     */
    private String requestParams;
    /**
     * 请求时间
     */
    private Long timeConsuming;
    /**
     * 请求来源 (controller/service)
     */
    private String callFrom;



    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getTraceID() {
        return traceID;
    }

    public void setTraceID(String traceID) {
        this.traceID = traceID;
    }



    public String getRequestTime() {
        return requestTime;
    }

    public void setRequestTime(String requestTime) {
        this.requestTime = requestTime;
    }

    public String getRequestUrl() {
        return requestUrl;
    }

    public void setRequestUrl(String requestUrl) {
        this.requestUrl = requestUrl;
    }

    public String getRequestUri() {
        return requestUri;
    }

    public void setRequestUri(String requestUri) {
        this.requestUri = requestUri;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }

    public String getClientIP() {
        return clientIP;
    }

    public void setClientIP(String clientIP) {
        this.clientIP = clientIP;
    }

    public String getClazz() {
        return clazz;
    }

    public void setClazz(String clazz) {
        this.clazz = clazz;
    }

    public String getClassMethod() {
        return classMethod;
    }

    public void setClassMethod(String classMethod) {
        this.classMethod = classMethod;
    }

    public String getRequestParams() {
        return requestParams;
    }

    public void setRequestParams(String requestParams) {
        this.requestParams = requestParams;
    }

    public Long getTimeConsuming() {
        return timeConsuming;
    }

    public void setTimeConsuming(Long timeConsuming) {
        this.timeConsuming = timeConsuming;
    }

    public String getCallFrom() {
        return callFrom;
    }

    public void setCallFrom(String callFrom) {
        this.callFrom = callFrom;
    }




    public String getLogString() {
        StringBuilder sb = new StringBuilder();
        sb.append("traceID:");
        sb.append(this.traceID);
        sb.append("|");
        sb.append("clientIP:");
        sb.append(this.clientIP);

        sb.append("|");
        sb.append("requestTime:");
        sb.append(this.requestTime);
        sb.append("|");
        sb.append("requestUrl:");
        sb.append(this.requestUrl);
        sb.append("|");
        sb.append("requestMethod:");
        sb.append(this.requestMethod);
        sb.append("|");
        sb.append("classMethod:");
        sb.append(this.classMethod);
        sb.append("|");
        if (this.requestParams != null && this.requestParams.length() > 0) {
            sb.append("requestParams:");
            sb.append(this.requestParams);
        }
        sb.append("|");
        sb.append("timeConsuming:");
        sb.append(this.timeConsuming);

        return sb.toString();
    }
}
